//
//  OrderSubmitStateViewController.m
//  OMS
//
//  Created by goldeney on 14-10-11.
//  Copyright (c) 2014年 ShangHai Goldeneye Techonology Co.,Ltd. All rights reserved.
//

#import "MTCSubmitSuccessViewController.h"
#import "NSDictionary+DataFormat.h"

@interface MTCSubmitSuccessViewController ()

@property (nonatomic,strong) NSDictionary *orderResult;

@end

@implementation MTCSubmitSuccessViewController

-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        [self setTitle: @"合同提交结果"];
    }
    return self;
}

- (void)getPassingParameter:(id)object
{
    NSDictionary *result = object;
    self.orderResult = result;
    
    self.orderNumLabel.text = [result objectFormatForKey:@"合同编号"];
    self.projectNameLabel.text = [result objectFormatForKey:@"合同名称"];
    self.constructionLabel.text = [result objectFormatForKey:@"合同性质"];
    self.jhflLabel.text = [NSString stringWithFormat:@"%@立方",[result objectFormatForKey:@"签订方量"]];
    self.jhkpsjLabel.text = [result objectFormatForKey:@"签订日期"];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.extendedLayoutIncludesOpaqueBars = NO;
    self.edgesForExtendedLayout = UIRectEdgeBottom | UIRectEdgeLeft | UIRectEdgeRight;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark -
#pragma mark IBAction Event

- (IBAction)checkOrderButtonEvent:(id)sender
{
//    MainAppDelegate *appcation = [[UIApplication sharedApplication] delegate];
//    AbstractNavigationController *navigation = appcation.navigationController;
//    
//    NSString *identifyID = [self.orderResult objectFormatForKey:@"ID"];
//    OrderDetailsViewController *viewController = [[OrderDetailsViewController alloc] initWithOrderID:identifyID];
//    [navigation pushViewController:viewController animated:YES];
    
    [self backButtonEvent:sender];
}

- (void)backButtonEvent:(id)sender
{
    MainAppDelegate *mDelegate = [[UIApplication sharedApplication] delegate];
    NSArray *viewControllers = mDelegate.navigationController.viewControllers;
    UIViewController *closeController = [viewControllers objectAtIndex:viewControllers.count - 4];
    [mDelegate.navigationController popToViewController:closeController animated:YES];
}

@end
